export default class ApkVersionUtil {

    public static getApkVersionName() : string {
        if (cc.sys.isNative && cc.sys.os === cc.sys.OS_ANDROID) {
            let apkName : string = jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity","getApkVersionName", "()Ljava/lang/String;");
            return apkName
        }else if (cc.sys.isNative && cc.sys.os === cc.sys.OS_IOS) {
            return "ios"
        }else {
            if(CC_DEBUG){
                return "debug"
            }else {
                return "web"
            }
        }
    }

    public static getApkVersionCode() : number {
        if (cc.sys.isNative && cc.sys.os === cc.sys.OS_ANDROID) {
            let versionCode : number = jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity","getApkVersionCode", "()I");
            return versionCode
        }else if (cc.sys.isNative && cc.sys.os === cc.sys.OS_IOS) {
            return 0
        }else {
            if(CC_DEBUG){
                return 0
            }else {
                return 1
            }
        }
    }
}
